<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="UTF-8"/>
    <link th:href="@{/static/bootstrap/css/bootstrap.min.css}" rel="stylesheet"/>
    <script th:src="@{/static/util/js/jquery-2.1.0.js}"></script>
    <script th:src="@{/static/layer/layer.js}"></script>
    <style>


    </style>
    <script th:inline="javascript">
        /*<![CDATA[*/
        ctxPath = /*[[@{/}]]*/ '';

        /*]]>*/
        var img=[[${session.loginUser.img}]];

        function choose(obj) {
            $("#myImg").attr("src", $(obj).attr("src"));
        }

        function choose1() {
            if ($("#myImg").attr("src")!=img){

                $.post(ctxPath+"user/resetImg",{img:$("#myImg").attr("src")},function (data) {
                    layer.alert(data);
                })
            }else {
                layer.alert("请选择头像")
            }


        }

    </script>
</head>
<body style="width: 380px;padding: 30px">
<div style="width: 100px;margin: 0 auto">
    <img id="myImg" th:src="@{${session.loginUser.img}}" style="margin: 0 auto" class="img-circle" height="100"/>
</div>
<div >

    <img th:src="@{/img/tx/touxiang1.jpg}" class="img-circle" onclick="choose(this)" height="100"/>
    <img th:src="@{/img/tx/touxiang2.jpg}" class="img-circle" onclick="choose(this)" height="100"/>
    <img th:src="@{/img/tx/touxiang3.jpg}" class="img-circle" onclick="choose(this)" height="100"/>
    <img th:src="@{/img/tx/touxiang4.jpg}" class="img-circle" onclick="choose(this)" height="100"/>
    <img th:src="@{/img/tx/touxiang5.jpg}" class="img-circle" onclick="choose(this)" height="100"/>
    <img th:src="@{/img/tx/touxiang6.jpg}" class="img-circle" onclick="choose(this)" height="100"/>
    <img th:src="@{/img/tx/touxiang7.jpg}" class="img-circle" onclick="choose(this)" height="100"/>
    <img th:src="@{/img/tx/touxiang8.jpg}" class="img-circle" onclick="choose(this)" height="100"/>
    <img th:src="@{/img/tx/touxiang9.jpg}" class="img-circle" onclick="choose(this)" height="100"/>
    <img th:src="@{/img/tx/touxiang10.jpg}" class="img-circle" onclick="choose(this)" height="100"/>
    <img th:src="@{/img/tx/touxiang11.jpg}" class="img-circle" onclick="choose(this)" height="100"/>
    <img th:src="@{/img/tx/touxiang12.jpg}" class="img-circle" onclick="choose(this)" height="100"/>

</div>
<div>
    <div class="btn btn-primary btn-block" onclick="choose1()">确定选择</div>
</div>
</body>
</html>